import request from '@/config/axios'

// 用户 VO
export interface BizUserVO {
  id: number // 主键
  nickname: string // 昵称
  avatar: string // 头像
  mobile: string // 手机号
  openId: string // 微信OpenID
  status: boolean // 账户状态（1正常 0封禁）
  lastLoginTime: Date // 最近一次登录时间
}

// 用户 API
export const BizUserApi = {
  // 查询用户分页
  getBizUserPage: async (params: any) => {
    return await request.get({ url: `/business/biz-user/page`, params })
  },

  // 查询用户详情
  getBizUser: async (id: number) => {
    return await request.get({ url: `/business/biz-user/get?id=` + id })
  },

  // 新增用户
  createBizUser: async (data: BizUserVO) => {
    return await request.post({ url: `/business/biz-user/create`, data })
  },

  // 修改用户
  updateBizUser: async (data: BizUserVO) => {
    return await request.put({ url: `/business/biz-user/update`, data })
  },

  // 删除用户
  deleteBizUser: async (id: number) => {
    return await request.delete({ url: `/business/biz-user/delete?id=` + id })
  },

  // 导出用户 Excel
  exportBizUser: async (params) => {
    return await request.download({ url: `/business/biz-user/export-excel`, params })
  },
}